package com.qingke.practise;

public class MyTime {
	private int hour;
	private int minute;
	private int second;
	
	public MyTime(int hour,int minute,int second){
		this.hour=hour;
		this.minute=minute;
		this.second=second;
	}
	public MyTime(int hour,int minute){
		this.hour=hour;
		this.minute=minute;
	}
	
	public int getHour() {
		return hour;
	}
	public void setHour(int hour) {
		this.hour = hour;
	}
	public int getMinute() {
		return minute;
	}
	public void setMinute(int minute) {
		this.minute = minute;
	}
	public int getSecond() {
		return second;
	}
	public void setSecond(int second) {
		this.second = second;
	}
	
	public void display(){
		System.out.println(hour+":"+minute+":"+second);
	}
	public void addSecond(int sec){
		this.second+=sec;
	}
	public void addMinute(int min){
		this.minute+=min;
	}
	public void addhour(int hou){
		if(this.hour+hou>24){
			this.hour=0;
		}else{
			this.hour+=hou;
		}
	}
	public void subSecond(int sec){
		this.second-=sec;
	}
	public void subMinute(int min){
		this.minute-=min;
	}
	public void subhour(int hou){
		this.hour-=hou;
	}
	public static void main(String[]args){
		MyTime time=new MyTime(22,34,34);
		time.addhour(1);
		time.display();
	}
}
